package com.ght.springboot.schedule;

import org.quartz.*;
import org.quartz.impl.StdSchedulerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import static org.quartz.SimpleScheduleBuilder.simpleSchedule;

/**
 * @description:
 * @author: haitao.gao
 * @create: 2019-03-11 22:15
 **/
public class GetSchedual {

//    public static Logger logger = LoggerFactory.getLogger(GetSchedual.class);
//
//    public static void main(String[] args) throws SchedulerException {
//
//        Scheduler scheduler = StdSchedulerFactory.getDefaultScheduler();
//        scheduler.start();
//        registerJobAndTrigger(scheduler);
//    }
//
//    private static void registerJobAndTrigger(Scheduler scheduler) {
//
//        JobDetail job = JobBuilder.newJob(TestSchedule.class)
//                .withIdentity("mySimpleJob", "simpleGroup")
//                .build();
//
//        Trigger trigger = org.quartz.TriggerBuilder.newTrigger()
//                .withIdentity("simpleTrigger", "simpleGroup")
//                .startNow()
//                .withSchedule(simpleSchedule()
//                        .withIntervalInSeconds(10)
//                        .repeatForever())
//                .build();
//
//        try {
//            scheduler.scheduleJob(job, trigger);
//        } catch (SchedulerException e) {
//            logger.error("注册任务和触发器失败", e);
//        }
//    }

}
